/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2012-2019.
 * Description: header for early kbox
 * Author: laiyuanyuan
 * Create: 2012-6-18
 */

#ifndef EARLY_KBOX_H
#define EARLY_KBOX_H

#ifdef CONFIG_RTOS_EARLY_KBOX
void ekbox_record_point_fmt(const char *fmt, ...)
	__printf(1, 2);
extern char *ekbox_pcontent;
#define EARLY_KBOX_RECORD_POINT() ekbox_record_point_fmt("[%s:%d]\n", __func__, __LINE__)

extern void ekbox_reboot_record(const char *func, int line);
#define EKBOX_REBOOT_RECORD() ekbox_reboot_record(__func__, __LINE__)
#else
#define EARLY_KBOX_RECORD_POINT()
#define EKBOX_REBOOT_RECORD()
#endif

#ifdef CONFIG_FIQ_GLUE
#include <linux/hal/fiq_glue.h>
#define EKBOX_RESERVE_SIZE ((FIQ_CPUS_MAX) * (2) + (1)) /* abcd#ABCD#; the '1' means '\n' */
#elif defined (CONFIG_RTOS_PPC_DYING_INT)
#include <linux/threads.h>
#define EKBOX_RESERVE_SIZE ((NR_CPUS) + (1)) /* resreve 1 byte to save '\n' */
#elif defined (CONFIG_RTOS_HAL_CORE_RESET_LOG)
#define EKBOX_RESERVE_SIZE ((32) * (2) + (1)) /* 32 equals arm32 max NR_CPUS,  bcd# BCD#; the '1' means '\n' */
#else
#define EKBOX_RESERVE_SIZE 0
#endif // End of CONFIG_FIQ_GLUE
extern int register_ekbox_reserved_mem_format_notifier(struct notifier_block *nb);
extern int unregister_ekbox_reserved_mem_format_notifier(struct notifier_block *nb);
extern void ekbox_record_point(const char *buf, size_t len);

#endif
